package com.laboratory.thread;

import java.util.concurrent.Future;

public class ThreadLocalDemo {

	public static void main(String[] args)  {
		try {
//			test();
		}catch (Exception e){
			System.out.println("++++==");
		}
      new ThreadLocalDemo().test2();
	}
	public  void test2(){
		new Te().run();
	}
	private class Te implements  Runnable{

		@Override
		public void run() {
			System.out.println("true = " + true);
		}
	}
	public static  void test() throws  Exception{
		Future<?> submit = TaskEngine.getInstance().submit(new Runnable() {
			@Override
			public void run() {
				System.out.println("--s-s-sssdss----");
			}
		});
		Object o = submit.get();
		System.out.println("--s-s-sssdss----" +  o);

		for(int i =0; i<100; i++){
			final  int ii = i;
//			System.out.println( "--------------------"  + ii);

			TaskEngine.getInstance().submit(new Runnable() {
				@Override
				public void run() {
					/*if (ii == 1) {
						try {
							Thread.sleep(200);
						} catch (InterruptedException e) {
							e.printStackTrace();
						}
						Thread.interrupted();
						int a = 1 / 0;

					}*/
					System.out.println( "==================="  + ii);
				}
			});

		}

	}
}
